<template>
  <div class="wrapper">
    <div>
      <BreakSpace label="车辆信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel
        ref="infoMain"
        :list="formList"
        :cols="3"
        @formChange="changeHandle"
        :labelWidth="85"
        :isSubmitBtn="false" />
    </div>
    <div>
      <BreakSpace label="新车主信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel
        ref="infoMain2"
        :list="formList2"
        :cols="3"
        @formChange="changeHandle"
        :labelWidth="85"
        :isSubmitBtn="false" />
    </div>
    <div>
      <BreakSpace label="原车主信息" :containerStyle="{ marginBottom: '10px' }" />
      <FormPanel
        ref="infoMain3"
        :list="formList3"
        :cols="3"
        @formChange="changeHandle"
        :labelWidth="85"
        :isSubmitBtn="false" />
    </div>
    <div class="dialogBottmView">
      <el-button @click="closeDialog()">关 闭</el-button>
    </div>
  </div>
</template>

<script>
import { dictionary } from '@/utils/dictMixin';
import { authority } from '@/utils/authMixin';
export default {
  name: "detailed",
  mixins: [dictionary,authority],
  props: {
    row: {
      type: Object,
      required: true
    }
  },
  data() {
    return {
      formList: this.createFormList(),
      formList2: this.createFormList2(),
      formList3: this.createFormList3(),
    };
  },
  mounted() {
    this.formList.forEach(x => {
      x.initialValue = this.row[x.fieldName];
    })
    this.formList2.forEach(x => {
      if(x.fieldName === 'newOwnerProperty'){
        x.initialValue = this.createDlrDictText(this.row[x.fieldName],'8011');
      }else{
        x.initialValue = this.row[x.fieldName];
      }
    })
    this.formList3.forEach(x => {
      if(x.fieldName === 'oldOwnerProperty'){
        x.initialValue = this.createDlrDictText(this.row[x.fieldName],'8011');
      }else {
        x.initialValue = this.row[x.fieldName];
      }
    })
  },
  methods:{
    createFormList() {
      return [
        { type: 'INPUT', label: 'VIN', fieldName: 'vin', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车牌号', fieldName: 'license', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '电机号', fieldName: 'motorNo', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车系', fieldName: 'seriesName', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车型', fieldName: 'modelName', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '备注', fieldName: 'remark', placeholder: '请选择', initialValue: '', disabled: true }
      ];
    },
    createFormList2() {
      return [
        { type: 'INPUT', label: '车主姓名', fieldName: 'newOwnerName', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '手机', fieldName: 'newMobile', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主性质', fieldName: 'newOwnerProperty', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主地址', fieldName: 'newAddress', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主备注', fieldName: 'newOwnerRemark', placeholder: '请选择', initialValue: '', disabled: true }
      ];
    },
    createFormList3() {
      return [
        { type: 'INPUT', label: '车主姓名', fieldName: 'oldOwnerName', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '手机', fieldName: 'oldMobile', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主性质', fieldName: 'oldOwnerProperty', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主地址', fieldName: 'oldAddress', placeholder: '请选择', initialValue: '', disabled: true },
        { type: 'INPUT', label: '车主备注', fieldName: 'oldOwnerRemark', placeholder: '请选择', initialValue: '', disabled: true }
      ];
    },
    closeDialog() {
      this.$emit('close');
    },
    changeHandle(data) {
    }
  }
}
</script>

<style scoped>

</style>
